StopMotor
Stops / brakes specified motor. (Synchronisation will be lost after this)
Contents
Syntax
StopMotor(port, mode)
StopMotor(port, mode, handle)
Description
StopMotor(port, mode) stops the motor connected to the given port. The value port can be addressed by the symbolic constants MOTOR_A, MOTOR_B, MOTOR_C and 'all' (all motor at at the same time) analog to the labeling on the NXT Brick. The argument mode can be equal to 'off' which cuts off the electrical power to the specific motor, so called "COAST" mode. The option 'brake' will actively halt the motor at the current position (until the next command).
The last optional argument can be a valid NXT handle. If none is specified, the default handle will be used (call COM_SetDefaultNXT to set one).
Note:
The value port equal to 'all' can be used to stopp all motors at the same time using only one single Bluetooth packet. After a StopMotor command the motor snychronization will be lost.
With mode equal to 'off', the motor will slowly stop spinning, but using 'brake' applies real force to the motor to stand still at the current position, just like a real brake.
When calling StopMotor(..., 'off'), you also internally issue the commands SpeedRegulation('off') and SyncToMotor('off'), while using 'brake' will call SpeedRegulation('on') and SyncToMotor('off').
Example
SetMotor(MOTOR_B);
SetPower(-55);
SetAngleLimit(1200);
SendMotorSettings();
WaitForMotor(MOTOR_A);
StopMotor(MOTOR_B, 'brake');
See also
WaitForMotor, SendMotorSettings, MOTOR_A, MOTOR_B, MOTOR_C
Signature
- Author: Linus Atorf, Alexander Behrens (see AUTHORS)
- Date: 2007/10/15
- Copyright: 2007-2008, RWTH Aachen University